﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Configuration;

namespace Lisphi.Lab.K2Site
{
    public class UserInfo
    {
        private string _userName;
        private string _password;

        public UserInfo(string userName, string password)
        {
            this._userName = userName;
            this._password = password;
        }

        public string UserName
        {
            get { return this._userName; }
            set { this._userName = value; }
        }

        public string Password
        {
            get { return this._password; }
            set { this._password = value; }
        }
    }

    public class UserInfoList : Dictionary<string, UserInfo>
    {
        public UserInfoList()
        {
            this.Add("chunleih", new UserInfo("chunleih", "Password@8"));
            this.Add("mdliu", new UserInfo("mdliu", "Ms12345678"));
        }

        public static UserInfo GetUser(string userName)
        {
            UserInfoList userList = new UserInfoList();
            if (string.IsNullOrEmpty(userName)) return null;
            if (userList.ContainsKey(userName.ToLower()))
                return userList[userName];
            else
                return null;
        }
    }
}
